home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{5E969A41-5923-11D0-B191-444553540000}#1.0#0"; "CRCCTRL.OCX"
- Begin VB.Form mainform
- BackColor = &H00E0E0E0&
- Caption = "Test CRC OCX"
- ClientHeight = 2565
- ClientLeft = 1200
- ClientTop = 1695
- ClientWidth = 4500
- ForeColor = &H00404040&
- LinkTopic = "Form1"
- PaletteMode = 1 'UseZOrder
- Picture = "mainform.frx":0000
- ScaleHeight = 2565
- ScaleWidth = 4500
- Begin VB.ComboBox crclist
- Height = 315
- ItemData = "mainform.frx":0446
- Left = 150
- List = "mainform.frx":0462
- TabIndex = 8
- Text = "Crc type"
- Top = 1470
- Width = 4185
- End
- Begin VB.CommandButton cmdVisible
- Caption = "Hide"
- Height = 495
- Left = 120
- TabIndex = 6
- Top = 1980
- Width = 1305
- End
- Begin VB.CommandButton cmdExit
- Cancel = -1 'True
- Caption = "Exit"
- Default = -1 'True
- Height = 495
- Left = 3030
- TabIndex = 1
- Top = 1980
- Width = 1305
- End
- Begin VB.CommandButton cmdDoCRC
- Caption = "Do CRC"
- Height = 495
- Left = 1590
- TabIndex = 0
- Top = 1980
- Width = 1305
- End
- Begin CRCCTRLLib.CrcCtrl crcTest
- Height = 405
- Left = 120
- TabIndex = 7
- Top = 870
- Width = 4185
- _Version = 65537
- _ExtentX = 7382
- _ExtentY = 714
- _StockProps = 0
- CRCType = 6
- End
- Begin VB.Label Label2
- Caption = "CRC"
- Height = 285
- Left = 120
- TabIndex = 5
- Top = 450
- Width = 1545
- End
- Begin VB.Label Label1
- Caption = "Speed"
- Height = 285
- Left = 120
- TabIndex = 4
- Top = 120
- Width = 1545
- End
- Begin VB.Label lblticks
- Caption = " "
- Height = 285
- Left = 1710
- TabIndex = 3
- Top = 120
- Width = 2595
- End
- Begin VB.Label lblResult
- Caption = "0"
- Height = 285
- Left = 1710
- TabIndex = 2
- Top = 450
- Width = 2595
- End
- Attribute VB_Name = "mainform"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim Data As String
- Dim Cnt As Long
- Dim Seed As Long
- Dim tickstart As Long
- Private Sub cmdDoCRC_Click()
- lblticks = "Stated"
- tickstart = GetTickCount
- lblResult = Hex(crcTest.DoCRC(Data, Cnt, False, Seed))
- lblticks = Str((GetTickCount - tickstart) * (1048576 * 0.001 / Cnt)) & " secs/MB"
- End Sub
- Private Sub cmdExit_Click()
- Unload Me
- End Sub
- Public Function StrAddress(ByVal StrRef As Long) As Long
- StrAddress = CLng(StrRef)
- End Function
- Private Sub cmdVisible_Click()
- If cmdVisible.Caption = "Show" Then
- cmdVisible.Caption = "Hide"
- crcTest.Visible = True
- Else
- cmdVisible.Caption = "Show"
- crcTest.Visible = False
- End If
- End Sub
- Private Sub crclist_Click()
- crcTest.CRCType = crclist.ListIndex
- End Sub
- Private Sub Form_Load()
- Dim mbytes As Single
- crclist.ListIndex = crcTest.CRCType
- mbytes = 0.25
- 'Cnt = mbytes * 1048576
- 'Data = "Hello" & String(mbytes * 1048576, Chr(0))
- Dim fnum As Integer
- fnum = FreeFile
- Open "testdata.dat" For Binary Access Read As #fnum
- Cnt = LOF(fnum)
- If Cnt = 0 Then
- MsgBox "require a data file call testdat.dat with some data"
- End
- End If
- Data = String(Cnt, Chr(0))
- Get #fnum, , Data
- Close #fnum
- fnum = FreeFile
- Open "testdata.out" For Binary Access Write As #fnum
- Put #fnum, , Data
- Close #fnum
- End Sub
-